Skip to content

feat(cli): okdev restart and short-name pod addressing#158

Merged
acmore merged 2 commits into
mainfrom
feat/restart-and-role-addressing
Jul 5, 2026
Merged

feat(cli): okdev restart and short-name pod addressing#158
acmore merged 2 commits into
mainfrom
feat/restart-and-role-addressing

Conversation

@acmore

@acmore acmore commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Closes out feedback item 4 (dead container → costly session rebuild; pod hash names invalidate every script on recreation).

okdev restart [session] [--yes] [--wait-timeout]

One-command recovery when a container died and the restart policy won't bring it back: delete the workload → wait for termination → reset local per-session sync state → full up flow with the same config. PVCs untouched; lifecycle hooks (postCreate/postSync) re-run on the fresh pods; sync re-bootstraps. Prompts unless --yes (refuses non-interactive without it).

Short-name pod addressing

--pod on exec/cp/jobs ... and target set --pod now accept, in order: the full pod name, the short name shown by okdev status (master-0, worker-1), or any unique -<name> suffix — so scripts survive the pod-name hash changing on every recreation.

  • Unknown/ambiguous names error with the available aliases — replacing the old silent-drop behavior where a typo just matched nothing.
  • --exclude accepts the same aliases but tolerates unknown names (an excluded pod may legitimately no longer exist).
  • --group already supported short names; this makes the whole surface consistent.

Docs/skill

Command reference (restart + alias forms), skill guidance (recovery path, aliases as the preferred addressing style per the original feedback), and the lifecycle-hook discoverability note — the requested "post-up hook" is what spec.lifecycle.postCreate/postSync already do (their done-markers are pod annotations, so recreated pods re-run them); the gap was documentation.

Testing

  • Unit: alias resolution (full/short/suffix, dedup, unknown lists aliases, ambiguity), alias-aware exclude leniency, target-set alias path, restart command shape + non-interactive refusal.
  • Kind e2e: smoke gains a restart scenario (pod UID must change; exec works after); the PyTorchJob workflow asserts --pod master-0 / --pod worker-1 reach the right pods end-to-end and that an unknown short name errors with guidance.
  • gofmt -l clean; go test -race ./... passes.

🤖 Generated with Claude Code

acmore and others added 2 commits July 5, 2026 21:43
Field feedback asked for a "post-up hook" — which spec.lifecycle
postCreate/postSync already are (their done-markers are pod annotations,
so recreated pods re-run them automatically). The gap was
discoverability: neither the skill guidance nor the reconcile
troubleshooting mentioned them.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Two recovery-experience fixes for multi-pod training sessions:

okdev restart [session]: one-command recovery when a container died and
the restart policy will not bring it back — delete the workload, wait
for termination, reset local per-session sync state, and run the full
up flow with the same config. PVCs are untouched; lifecycle hooks
re-run on the fresh pods. Prompts unless --yes.

Short-name pod addressing: --pod on exec/cp/jobs and target set --pod
now accept the short names shown by `okdev status` (master-0, worker-1)
and any unique "-<name>" suffix, in addition to full pod names — so
scripts survive the pod-name hash changing on every recreation. Unknown
or ambiguous names error with the available aliases instead of the old
silent-drop behavior; --exclude accepts the same aliases but tolerates
unknown names (an excluded pod may no longer exist). --group already
accepted short names; this makes the rest of the surface consistent.

Docs and skill updated: restart reference, alias forms as the preferred
addressing style, and the lifecycle-hook discoverability note (field
feedback asked for a "post-up hook" that postCreate/postSync already
provide — the gap was documentation).

Kind e2e: smoke gains a restart scenario (pod UID must change, exec
works after); the PyTorchJob workflow verifies master-0/worker-1
addressing end-to-end plus the unknown-name error.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@acmore acmore merged commit 5104077 into main Jul 5, 2026
2 checks passed
@acmore acmore deleted the feat/restart-and-role-addressing branch July 5, 2026 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant